package com.csg.controller;

import com.alibaba.fastjson.JSON;
import com.csg.annotation.RequestUser;
import com.csg.feign.SystemFeignClient;
import com.csg.model.RequestSubject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author George Chan
 * @version 1.0
 * @date 2020/2/14 21:59
 * @since jdk1.8
 */
@RestController
public class VideoController {
    private static final Logger LOGGER = LoggerFactory.getLogger(VideoController.class);

    private final SystemFeignClient systemFeignClient;

    @Autowired
    public VideoController(SystemFeignClient systemFeignClient) {
        this.systemFeignClient = systemFeignClient;
    }

    @RequestMapping(value = "/test1", method = RequestMethod.GET)
    public String testFeignClient(@RequestUser RequestSubject subject) {
        LOGGER.info("*************************************");
        LOGGER.info("当前登录人信息===》 " + JSON.toJSONString(subject));
        LOGGER.info("*************************************");
        String message = systemFeignClient.sayHelloFeign();
        return message;
    }

    @GetMapping("/test2")
    public String testString() {
        return "hello中文字符串";
    }
}
